//
//  TNHeadmanViewController.m
//  跑跑快销
//
//  Created by ylife on 14-5-8.
//  Copyright (c) 2014年 ylife. All rights reserved.
//

#import "TNHeadmanViewController.h"

@interface TNHeadmanViewController ()

@end

@implementation TNHeadmanViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    //初始化团长界面
    _headView = [[TNMyHeadManView alloc]init];
    _headView.myTableview.delegate = self;
    _headView.myTableview.dataSource = self;
    self.view = _headView;
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)sendMessage
{
    NSLog(@"发信息");
}

- (void)removeFriend
{
    NSLog(@"删除好友");
}

#pragma mark - tableview代理方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        static NSString *identifier = @"HeadCell";
        HeadCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
        if (!cell) {
            cell = [[HeadCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        }
        cell.headImageView.image = [UIImage imageNamed:@"b.png"];
        cell.nameLab.text = @"山风";
        return cell;
        
    }
    else if (indexPath.row == 1){
        static NSString *identifier = @"InfoCell";
        InfoCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
        if (!cell) {
            cell = [[InfoCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        }
        cell.sexLab.text = @"男";
        cell.jodLab.text = @"乳制品";
        cell.signLab.text = @"今天天气不错";
        return cell;
    }
    else
    {
        static NSString *identifier = @"ButtonCell";
        ButtonCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
        if (!cell) {
            cell = [[ButtonCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        }
        [cell.sendMsgButton addTarget:self action:@selector(sendMessage) forControlEvents:UIControlEventTouchUpInside];
        [cell.removeFriendButton addTarget:self action:@selector(removeFriend) forControlEvents:UIControlEventTouchUpInside];
        return cell;
    }
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        return 80;
    }
    else if (indexPath.row == 1){
        return 150;
    }
    else
        return 50;
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
